package org.example.spring.controller.User;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.example.spring.domain.pojo.Category;
import org.example.spring.domain.pojo.Result;
import org.example.spring.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

@RestController("userCategoryController")
@RequestMapping("/user/category")
@Api(tags = "分类相关接口")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @ApiOperation(value = "获取所有分类")
    @GetMapping("/getAllCategory")
    public Result<ArrayList<Category>> getAllCategory() {
        ArrayList<Category> categories = categoryService.getAllCategory();
        return Result.success(categories);
    }

}
